using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
    public class EmployeeInfo
    {
		#region Local Variable
		private String _EmployeeCode;
		public String EmployeeCode
		{
			get { return _EmployeeCode; }
			set { _EmployeeCode = value; }
		}
		private String _EmployeeName;
		public String EmployeeName
		{
			get { return _EmployeeName; }
			set { _EmployeeName = value; }
		}
        #endregion LocalVariable
        
        #region Constructor
		public EmployeeInfo()
		{
			_EmployeeCode = "";
			_EmployeeName = "";
		}
		public EmployeeInfo(
			String EmployeeCode,
			String EmployeeName
			)
		{
			_EmployeeCode = EmployeeCode;
			_EmployeeName = EmployeeName;
		}
		public EmployeeInfo(DataRow dr)
		{
			if (dr != null)
			{
				_EmployeeCode = dr["EmployeeCode"] == DBNull.Value ? "" : (String)dr["EmployeeCode"];
				_EmployeeName = dr["EmployeeName"] == DBNull.Value ? "" : (String)dr["EmployeeName"];
			}
		}
        #endregion Constructor
        
        #region InitTable
		public DataTable ToDataTable()
		{
			DataTable dt = new DataTable("TblEmployee");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn("EmployeeCode", typeof(String)),
				new DataColumn("EmployeeName", typeof(String))
				});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row["EmployeeCode"] = _EmployeeCode;
			row["EmployeeName"] = _EmployeeName;
			return row;
		}
        #endregion InitTable
    }
}
